package com.zhongkun.datahome.web.rest;

import java.util.List;
import javax.annotation.Resource;

import com.zhongkun.datahome.common.core.domain.R;
import com.zhongkun.datahome.service.domain.HouseBuildPlan;
import com.zhongkun.datahome.service.req.cmd.plan.HouseBuildPlanCmd;
import com.zhongkun.datahome.service.service.IHouseBuildPlanService;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zhongkun.datahome.common.annotation.Log;
import com.zhongkun.datahome.common.core.controller.BaseController;
import com.zhongkun.datahome.common.enums.BusinessType;

/**
 * 房产施工计划Controller
 * 
 * @author ruoyi
 * @date 2025-04-14
 */
@RestController
@RequestMapping("/core/buildPlan")
public class HouseBuildPlanController extends BaseController {
    @Resource
    private IHouseBuildPlanService houseBuildPlanService;


    @ApiOperation("查询房产施工计划列表")
    @PreAuthorize("@ss.hasPermi('core:buildPlan:list')")
    @GetMapping("/list")
    public R<List<HouseBuildPlan>> list(Long houseId) {
        return R.ok(houseBuildPlanService.list(houseId));
    }

    @ApiOperation("保存房产施工计划")
    @PreAuthorize("@ss.hasPermi('core:buildPlan:save')")
    @Log(title = "房产施工计划", businessType = BusinessType.UPDATE)
    @PostMapping
    public R<Void> save(@RequestBody HouseBuildPlanCmd cmd) {
        houseBuildPlanService.save(cmd);
        return R.ok();
    }
}
